import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementPlus from 'element-plus';
import { ElMessage } from 'element-plus';
import axios from 'axios';
import 'element-plus/dist/index.css';
import './assets/css/global.css';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import UUID from "vue-uuid";

//配置请求的根路径
axios.defaults.baseURL = 'http://127.0.0.1:9090/ams';
const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
axios.interceptors.request.use((config)=>{
    config.headers.Authorization = window.sessionStorage.getItem("token");
    return config;
})

//挂载全局对象w
app.config.globalProperties.$http = axios;
app.config.globalProperties.$message = ElMessage;
app.use(store).use(router).use(ElementPlus).use(UUID).mount("#app");